import request from '@/utils/request'
interface ResponseData {
  list: [],
  total: 0,
}
// 获取系统配置数据
export const getSettings = () =>
  request({
    url: 'system/config/list/settings',
  })

// 获取系统配置数据
export const setSetting = (data: any) =>
  request({
    url: 'system/config/setting',
    method: 'post',
    data,
  })

/**
 * 获取用户信息
 * @param params
 * @returns
 */
// export const getUser = <T>(params?: any) => request.get<T>('admin/info', { params })

// 角色相关接口
/**
 * 查询所有角色
 * @param params
 * @returns
 */
export const roleQueryAll = <T>(data?: any) =>
  request.post<T>('/admin-core/web/role/v1/queryAllList', data)

/**
 * 查询分页角色
 * @param params
 * @returns
 */
export const roleQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/role/v1/queryPage', data)

/**
 * 删除角色
 * @param params
 * @returns
 */
export const removeRole = <T>(data?: any) =>
  request.post<T>('/admin-core/web/role/v1/remove', data)

/**
 * 保存角色
 * @param params
 * @returns
 */
export const saveRole = <T>(data?: any) =>
  request.post<T>('/admin-core/web/role/v1/save', data)

/**
 * 更新角色
 * @param params
 * @returns
 */
export const updateRole = <T>(data?: any) =>
  request.post<T>('/admin-core/web/role/v1/update', data)

// 资源相关接口
/**
 * 查询所有资源
 * @param params
 * @returns
 */
export const resourceQueryAll = <T>(data?: any) =>
  request.post<T>('/admin-core/web/resource/v1/queryAllList', data)

/**
 * 查询分页资源
 * @param params
 * @returns
 */
export const resourceQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/resource/v1/queryPage', data)

/**
 * 删除资源
 * @param params
 * @returns
 */
export const removeResource = <T>(data?: any) =>
  request.post<T>('/admin-core/web/resource/v1/remove', data)

/**
 * 保存资源
 * @param params
 * @returns
 */
export const saveResource = <T>(data?: any) =>
  request.post<T>('/admin-core/web/resource/v1/save', data)

/**
 * 更新资源
 * @param params
 * @returns
 */
export const updateResource = <T>(data?: any) =>
  request.post<T>('/admin-core/web/resource/v1/update', data)


// 司机相关接口
/**
 * 分页查询
 * @param params
 * @returns
 */
export const driverQueryPage = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/driver/v1/queryPage', data)

/**
 * 删除司机
 * @param params
 * @returns
 */
export const removeDriver = <T>(data?: any) =>
  request.post<T>('/admin-core/web/driver/v1/remove', data)

/**
 * 保存司机
 * @param params
 * @returns
 */
export const saveDriver = <T>(data?: any) =>
  request.post<T>('/admin-core/web/driver/v1/save', data)

/**
 * 更新司机
 * @param params
 * @returns
 */
export const updateDriver = <T>(data?: any) =>
  request.post<T>('/admin-core/web/driver/v1/update', data)


// 价格配置接口
/**
 * 分页查询
 * @param params
 * @returns
 */
export const priceConfigQueryPage = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/priceConfig/v1/queryPage', data)

export const priceConfigQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/priceConfig/v1/queryOrderPricePage', data)


/**
 * 删除配置
 * @param params
 * @returns
 */
export const removePriceConfig = <T>(data?: any) =>
  request.post<T>('/admin-core/web/priceConfig/v1/remove', data)

/**
 * 保存配置
 * @param params
 * @returns
 */
export const savePriceConfig = <T>(data?: any) =>
  request.post<T>('/admin-core/web/priceConfig/v1/save', data)

/**
 * 更新配置
 * @param params
 * @returns
 */
export const updatePriceConfig = <T>(data?: any) =>
  request.post<T>('/admin-core/web/priceConfig/v1/update', data)

// 区域相关接口

/**
 * 根据城市code查询区信息
 * @param params
 * @returns
 */
export const queryAreaDictByCityCode = <T>(data?: any) =>
  request.post<T>('/admin-core/web/regions/v1/queryAreaDictByCityCode', data)

/**
 * 根据省code查询城市信息
 * @param params
 * @returns
 */
export const queryCityDictByProvinceCode = <T>(data?: any) =>
  request.post<T>('/admin-core/web/regions/v1/queryCityDictByProvinceCode', data)

/**
 * 查询所有省份信息
 * @param params
 * @returns
 */
export const queryProvinceDict = <T>(data?: any) =>
  request.post<T>('/admin-core/web/regions/v1/queryProvinceDict', data)

// 车辆司机绑定相关接口
/**
 * 绑定
 * @param params
 * @returns
 */
export const bindCarDriver = <T>(data?: any) =>
  request.post<T>('/admin-core/web/carDriverBind/v1/bind', data)

/**
 * 分页查询
 * @param params
 * @returns
 */
export const queryPageCarDriverBind = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/carDriverBind/v1/queryPage', data)

/**
 * 解绑
 * @param params
 * @returns
 */
export const unbindCarDriver = <T>(data?: any) =>
  request.post<T>('/admin-core/web/carDriverBind/v1/unbind', data)


/**
 * 分页查询可调度车辆
 * @param params
 * @returns
 */
export const queryOrderDispatchCar = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/car/v1/queryOrderDispatchCar', data)

/**
 * 分页查询可调度司机
 * @param params
 * @returns
 */
export const queryOrderDispatchDriver = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/driver/v1/queryOrderDispatchDriver', data)

/**
 * 获取登录账号资源权限
 * @param params
 * @returns
 */
export const getResourceList = <T>(data?: any) =>
  request.post<T>('/admin-core/web/account/v1/getResourceList', data)


/**
 * 查询通知列表
 * @param params
 * @returns
 */
export const queryNoticeList = <T>(data?: any) =>
  request.post<T>('/admin-core/web/notice/v1/queryNoticeList', data)

/**
 * 读取通知
 * @param params
 * @returns
 */
export const readNotice = <T>(data?: any) =>
  request.post<T>('/admin-core/web/notice/v1/readNotice', data)


/**
 * 模版下载
 * @param params
 * @returns
 */
export const getPriceTemplate = <T>() =>
  request.get<T>('/admin-core/template/价格配置信息导入模版.xlsx', { responseType: 'blob' })



